package exam;

import java.util.List;

public class 魔术师发牌问题 {
    public static void main(String[] args) {
        int[] a = new int[13];
        int point = -1;
        for (int j =0;j<=12;j++){
            for (int k=0;k<=j;k++){
                point++;
                if(point == 13){
                    point = 0;
                }
                while (a[point]>0){
                    point++;
                    if(point == 13){
                        point = 0;
                    }
                }
            }
            a[point] = j+1;
        }

        for(int x:a){
            System.out.print(x+" ");
        }
    }
}
